# Maintainer: Filipe Laíns (FFY00) <filipe.lains@gmail.com>

pkgname=cm256cc
pkgver=1.1.0
pkgrel=3
pkgdesc='Fast GF(256) Cauchy MDS Block Erasure Codec in C++'
arch=(loong64 x86_64)
url="https://github.com/f4exb/cm256cc"
license=(GPL3)
depends=(
  gcc-libs
  glibc
)
makedepends=(
  boost
  cmake
)
source=($url/archive/v$pkgver/$pkgname-v$pkgver.tar.gz)
sha512sums=('2bd02675bb2c1c2b422c626c92bd36a0c0fc7a46a0512475424b1bc781d816137eadc52f33f11e100cdc69a7a595f3153fbed0020d6038916e305a2923700959')
b2sums=('9c4a36b923bd58a26a85292d62fbd0b4fa1975d75b3b17ca9183c311031b1efd0508a1fe899e9da2f3d31c8540c9d1cb7dcedb65b60ab6f7a780e50f3ff3ae20')

build() {
  local cmake_options=(
    -B build
    -D CMAKE_BUILD_TYPE=None
    -D CMAKE_INSTALL_LIBDIR=lib
    -D CMAKE_INSTALL_PREFIX=/usr
    -S $pkgname-$pkgver
    -W no-dev
  )

  cmake "${cmake_options[@]}"
  cmake --build build --verbose
}

check() {
  ctest --test-dir build --output-on-failure
}

package() {
  DESTDIR="$pkgdir" cmake --install build
}
